<?php
class UsersController extends AppController {
	public $uses = array("Users");
	public function login(){
		$this->AuthComponent->login();
	}
	public function register(){
		$this->layout = 'user';
		if(!empty($this->data)):
			$this->data['password'] = $this->AuthComponent->hash($this->data['password']);
			$this->Users->save($this->data);
		endif;

	}
	public function logout(){
		$this->AuthComponent->logout();
	}
	public function index(){
		$id = $this->AuthComponent->user('id');
		$users = array('id'=>$id);
		$this->set("user", $this->Users->all($users));
	}
	public function admin(){
		$this->redirect('/admin', 304);
	}
}
?>
